home *** CD-ROM | disk | FTP | other *** search
/ Magnum One / Magnum One (Mid-American Digital) (Disc Manufacturing).iso / d12 / cbibcode.arc / FARFREE.C < prev    next >
Encoding:
C/C++ Source or Header  |  1991-08-05  |  594 b   |  20 lines

  1. /* farfree.c --- p. 132 */
  2. #include <stdio.h>
  3. #include <alloc.h>
  4. main()
  5. {
  6.     int far *bigblock;
  7.     printf("%lu bytes available in the far heap\n", farcoreleft());
  8.     if((bigblock = farmalloc(80000l)) == NULL)
  9.     {
  10.         printf("Memory allocation failed!\n");
  11.         exit(1);
  12.     }
  13.     printf("Block of 80,000 byets allocated at %Fp\n", bigblock);
  14.     printf("%lu bytes available in the far heap "
  15.                 "after allocation\n", farcoreleft());
  16.                              /* Now free the block */
  17.     farfree(bigblock);
  18.     printf("%lu bytes available in the far heap "
  19.                    "after freeing block\n", farcoreleft());
  20. }